package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.DtsUserMapper;
import com.qf.pojo.DtsAdmin;
import com.qf.pojo.DtsUser;
import com.qf.service.DtsUserService;
import com.qf.vo.DayStatis;
import com.qf.vo.StatUserVo;
import com.qf.vo.StatVo;
import com.qf.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Zwnan
 */
@Service
public class DtsUserServiceImpl implements DtsUserService {
    @Autowired
    private DtsUserMapper dtsUserMapper;

    @Override
    public Long selectCount() {
        return dtsUserMapper.selectCount(null);
    }

    @Override
    public List<DayStatis> findUserOrderCntVo(int statisDaysRang) {
        return dtsUserMapper.findUserOrderCntVo(statisDaysRang);
    }

    @Override
    public IPage<DtsUser> selectByPage(Integer page, Integer limit, String sort, String order) {
        IPage<DtsUser> iPage = new Page<>(page, limit);
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("deleted", false);
        return dtsUserMapper.selectPage(iPage,wrapper);
    }

    @Override
    public List<StatUserVo> findstatUser(int statisDaysRang) {

        return dtsUserMapper.findstatUser(statisDaysRang);
    }

    @Override
    public UserVo findByOrderId(Integer userId) {

        return dtsUserMapper.select(userId);
    }


}
